<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<title>斗地主测试</title>
<script src="/socket.io.js"></script>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script>
    $(function(){
        socket = io("101.36.117.183:3061");
        socket.on('connect', function(){
            console.log('connect a socket client');
        });
        socket.emit("open", {userId:300001})
        socket.on("open_result", function(data){
            console.log("open返回-----")
            console.log(data)
            let {gameId, roomId,index} = data || {};
            if(!roomId){
                socket.emit("room_match")
            }
        })
        socket.on("hello_result", function(data){
            console.log("hello_result-----")
            console.log(data)
        })
        socket.on("room_match_result", function(result){
            console.log("匹配房间得到结果")
            console.log(result)
            let {roomId} = result.data;
            socket.emit("room_enter", {roomId})
        })
        socket.on("room_enter_result", function(result){
            console.log("----------------进入房间------------")
            console.log(result)
            let {roomId} = result.data;
            socket.emit("room_sitdown", {roomId, index:1})
        })
        socket.on("room_sitdown_push", function(result){
            console.log("坐下推送")
            console.log(result)
        })
        // sendBtn = $("#send")
        // sendBtn.click(function(){
        //     let msg = $("#msg").val();
        //     msg = JSON.parse(msg)
        //     console.log("111111111111111")
        //     console.log(msg)
        //     socket.emit("user_command_send", msg);
        // })
    })
</script>
</head>
<body>
    <p>发送消息给具体玩家</p>
    <textarea id="msg">
        {"userId":3757225,"key":"SCUploadLog"}
    </textarea>
    <input type="button" value="发送" id="send">
</body>
</html>